Skip to content

[MR updates] use client arg for resource calls - rest of the tests#985

Merged
dbasunag merged 3 commits intoopendatahub-io:mainfrom
dbasunag:update_client_mr_2
Jan 8, 2026
Merged

[MR updates] use client arg for resource calls - rest of the tests#985
dbasunag merged 3 commits intoopendatahub-io:mainfrom
dbasunag:update_client_mr_2

Conversation

@dbasunag
Copy link
Copy Markdown
Collaborator

@dbasunag dbasunag commented Jan 6, 2026

Description

How Has This Been Tested?

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

Summary by CodeRabbit

  • Tests
    • Updated test suites to consistently pass an admin client when creating and managing resources.
    • Modified numerous fixture and test signatures to accept and propagate the admin client for resource instantiation.
    • Converted a fixture from returning a single object to a yield-based generator pattern for consistency across tests.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 6, 2026

The following are automatically added/executed:

  • PR size label.
  • Run pre-commit
  • Run tox
  • Add PR author as the PR assignee
  • Build image based on the PR

Available user actions:

  • To mark a PR as WIP, add /wip in a comment. To remove it from the PR comment /wip cancel to the PR.
  • To block merging of a PR, add /hold in a comment. To un-block merging of PR comment /hold cancel.
  • To mark a PR as approved, add /lgtm in a comment. To remove, add /lgtm cancel.
    lgtm label removed on each new commit push.
  • To mark PR as verified comment /verified to the PR, to un-verify comment /verified cancel to the PR.
    verified label removed on each new commit push.
  • To Cherry-pick a merged PR /cherry-pick <target_branch_name> to the PR. If <target_branch_name> is valid,
    and the current PR is merged, a cherry-picked PR would be created and linked to the current PR.
  • To build and push image to quay, add /build-push-pr-image in a comment. This would create an image with tag
    pr-<pr_number> to quay repository. This image tag, however would be deleted on PR merge or close action.
Supported labels

{'/hold', '/verified', '/cherry-pick', '/lgtm', '/wip', '/build-push-pr-image'}

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 6, 2026

📝 Walkthrough

Walkthrough

The PR threads an admin_client: DynamicClient through multiple model-registry test fixtures and tests, passing it into resource constructors; additionally, one ConfigMap fixture's return type changed to a generator signature (yield-style fixture).

Changes

Cohort / File(s) Summary
ConfigMap fixture return type
tests/model_registry/model_catalog/conftest.py
enabled_model_catalog_config_map fixture return type changed from ConfigMap to Generator[ConfigMap, None, None].
Negative-tests fixtures
tests/model_registry/model_registry/negative_tests/conftest.py, tests/model_registry/model_registry/negative_tests/test_model_registry_creation_negative.py
Added admin_client: DynamicClient to fixtures/tests and pass client=admin_client into Deployment and ModelRegistry constructions; updated delete_mr_deployment signature.
RBAC parametrized fixtures
tests/model_registry/model_registry/rbac/conftest.py
Multiple fixtures (db_secret_parametrized, db_pvc_parametrized, db_service_parametrized, db_deployment_parametrized, model_registry_instance_parametrized) now accept admin_client: DynamicClient and instantiate Secret, PersistentVolumeClaim, Service, Deployment, and ModelRegistry with client=admin_client.
REST API fixtures & helpers
tests/model_registry/model_registry/rest_api/conftest.py
model_registry_default_postgres_deployment_match_label now takes admin_client; Deployment and ModelRegistry creations pass client=admin_client.
REST API tests
tests/model_registry/model_registry/rest_api/test_model_registry_rest_api.py, tests/model_registry/model_registry/rest_api/test_multiple_mr.py
Tests updated to accept admin_client: DynamicClient where needed, annotate model_registry_instance as list[ModelRegistry], and pass client=admin_client when constructing ModelRegistry.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.96% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding the client argument to resource and ModelRegistry calls across multiple test files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/model_registry/rest_api/test_multiple_mr.py (1)

45-49: Consider removing unused model_registry_instance parameter from signature.

The model_registry_instance parameter is declared but never used in the test body, as flagged by Ruff. Since the fixture is already included in @pytest.mark.usefixtures (line 40), having it in the function signature is redundant unless you plan to use the fixture's return value in the test.

🔎 Proposed cleanup
     def test_validate_multiple_model_registry(
         self: Self,
-        model_registry_instance: list[ModelRegistry],
         model_registry_namespace: str,
         admin_client: DynamicClient,
     ):
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0ce4e49 and 517fb07.

📒 Files selected for processing (7)
  • tests/model_registry/model_catalog/conftest.py
  • tests/model_registry/negative_tests/conftest.py
  • tests/model_registry/negative_tests/test_model_registry_creation_negative.py
  • tests/model_registry/rbac/conftest.py
  • tests/model_registry/rest_api/conftest.py
  • tests/model_registry/rest_api/test_model_registry_rest_api.py
  • tests/model_registry/rest_api/test_multiple_mr.py
🧰 Additional context used
🧬 Code graph analysis (6)
tests/model_registry/rest_api/conftest.py (3)
tests/conftest.py (1)
  • admin_client (79-80)
tests/model_registry/conftest.py (1)
  • model_registry_namespace (76-77)
utilities/resources/model_registry_modelregistry_opendatahub_io.py (1)
  • ModelRegistry (9-94)
tests/model_registry/rest_api/test_multiple_mr.py (3)
tests/model_registry/conftest.py (2)
  • model_registry_instance (81-117)
  • model_registry_namespace (76-77)
utilities/resources/model_registry_modelregistry_opendatahub_io.py (1)
  • ModelRegistry (9-94)
tests/conftest.py (1)
  • admin_client (79-80)
tests/model_registry/negative_tests/conftest.py (1)
tests/conftest.py (1)
  • admin_client (79-80)
tests/model_registry/rest_api/test_model_registry_rest_api.py (3)
tests/conftest.py (1)
  • admin_client (79-80)
tests/model_registry/conftest.py (1)
  • model_registry_instance (81-117)
utilities/resources/model_registry_modelregistry_opendatahub_io.py (1)
  • ModelRegistry (9-94)
tests/model_registry/model_catalog/conftest.py (2)
tests/conftest.py (1)
  • admin_client (79-80)
tests/model_registry/conftest.py (1)
  • model_registry_namespace (76-77)
tests/model_registry/negative_tests/test_model_registry_creation_negative.py (1)
tests/conftest.py (1)
  • admin_client (79-80)
🪛 Ruff (0.14.10)
tests/model_registry/rest_api/test_multiple_mr.py

46-46: Unused method argument: model_registry_instance

(ARG002)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (13)
tests/model_registry/model_catalog/conftest.py (2)

46-46: Correct return type annotation.

The return type annotation now accurately reflects the yield-based fixture pattern. This improves type safety and IDE support.


335-337: Correct return type annotation and proper client parameter threading.

The changes correctly:

  • Update the return type to Generator[dict[str, Any], None, None] to match the yield pattern at line 357
  • Add admin_client parameter for explicit client passing to ConfigMap constructor (line 339)
  • Add model_registry_namespace parameter for proper namespace scoping

These changes align with the PR's objective to use client arguments for resource calls and improve type safety.

tests/model_registry/negative_tests/conftest.py (1)

169-173: LGTM! Admin client properly threaded through deployment deletion.

The fixture signature and Deployment constructor are correctly updated to use the admin_client parameter, ensuring proper permissions for resource deletion operations.

tests/model_registry/rest_api/conftest.py (2)

143-174: LGTM! ModelRegistry correctly instantiated with admin client.

The admin_client is properly passed to the ModelRegistry constructor on line 158, ensuring the secure MySQL and MR deployment uses the correct authenticated client context.


364-376: LGTM! Deployment lookup correctly uses admin client.

The fixture signature and Deployment constructor are properly updated to use admin_client, ensuring proper permissions when retrieving the default postgres deployment's match labels.

tests/model_registry/rbac/conftest.py (3)

142-176: LGTM! Parametrized Secret and PVC fixtures correctly use admin client.

Both db_secret_parametrized and db_pvc_parametrized fixtures are properly updated to accept and thread the admin_client through to their respective resource constructors, maintaining consistency with the PR's objective.


180-222: LGTM! Parametrized Service and Deployment fixtures correctly use admin client.

Both fixtures are properly updated to thread admin_client through to resource constructors. The addition of wait_for_replicas(deployed=True) on lines 219-220 ensures deployments are ready before tests proceed, which is a good reliability practice.


226-242: LGTM! ModelRegistry parametrized fixture correctly uses admin client.

The fixture properly threads admin_client to the ModelRegistry constructor on line 232, ensuring all MR instances are created with the correct authenticated client context. The wait conditions and logging enhance test reliability.

tests/model_registry/negative_tests/test_model_registry_creation_negative.py (2)

4-5: LGTM! Import properly added for DynamicClient type annotation.

The import is correctly placed and necessary for the type hint added to the test method signature.


33-71: LGTM! Test method correctly uses admin client for negative test scenario.

The test method properly receives admin_client as a fixture parameter and passes it to the ModelRegistry constructor. The negative test logic remains intact, correctly expecting a ForbiddenError when attempting to create a ModelRegistry in an unauthorized namespace.

tests/model_registry/rest_api/test_model_registry_rest_api.py (2)

169-182: LGTM! Test method correctly uses admin client and improved type hints.

The test method properly receives admin_client via fixture injection and passes it to the ModelRegistry constructor. The added type hint on line 172 improves code clarity. The test logic for validating API version remains unchanged.


184-191: LGTM! Type hint added for improved code clarity.

The type hint for model_registry_instance improves code clarity. This test doesn't require admin_client as it only reads the ModelRegistry spec without creating or modifying resources.

tests/model_registry/rest_api/test_multiple_mr.py (1)

51-56: LGTM! Admin client correctly integrated.

The ModelRegistry instances are now properly constructed with client=admin_client, which aligns with the PR objective of threading the admin client through resource calls.

@dbasunag dbasunag force-pushed the update_client_mr_2 branch from 517fb07 to 1879d85 Compare January 7, 2026 12:51
@github-actions github-actions Bot added size/s and removed size/m labels Jan 7, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/model_registry/model_registry/negative_tests/test_model_registry_creation_negative.py (1)

55-70: Fix the parameter name: use client= instead of client_token=.

Line 56 incorrectly uses client_token=admin_client when instantiating ModelRegistry. Based on the ModelRegistry class signature and all other usages in this PR, it should be client=admin_client.

🐛 Proposed fix
         with ModelRegistry(
-            client_token=admin_client,
+            client=admin_client,
             name=MR_INSTANCE_NAME,
🤖 Fix all issues with AI agents
In
@tests/model_registry/model_registry/negative_tests/test_model_registry_creation_negative.py:
- Line 6: The file contains an unused import "from tests.conftest import
admin_client" that conflicts with the pytest fixture parameter admin_client used
in the test function; remove that import line so the test relies on the
pytest-injected fixture (referenced as admin_client in the test function) to
eliminate the linter warning and redefinition.

In
@tests/model_registry/model_registry/rest_api/test_model_registry_rest_api.py:
- Line 5: Remove the incorrect import of the pytest fixture: delete the line
importing admin_client from tests.conftest in the test module; rely on pytest to
inject the admin_client fixture via test function parameter (as used in tests
like the one at line where admin_client is declared as a test argument) and
ensure no other code references expect a direct import of admin_client.
- Around line 172-173: The parameter list in the test function has a
hanging-indent misalignment: align the continuation parameter
"model_registry_instance: list[ModelRegistry]" with the previous parameter
"admin_client: DynamicClient" (i.e., same indentation level or under the opening
parenthesis per project style) so the two parameters form a properly aligned
multi-line parameter list; update the indentation for the symbol
model_registry_instance accordingly.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 517fb07 and 1879d85.

📒 Files selected for processing (7)
  • tests/model_registry/model_catalog/conftest.py
  • tests/model_registry/model_registry/negative_tests/conftest.py
  • tests/model_registry/model_registry/negative_tests/test_model_registry_creation_negative.py
  • tests/model_registry/model_registry/rbac/conftest.py
  • tests/model_registry/model_registry/rest_api/conftest.py
  • tests/model_registry/model_registry/rest_api/test_model_registry_rest_api.py
  • tests/model_registry/model_registry/rest_api/test_multiple_mr.py
🧰 Additional context used
🧬 Code graph analysis (5)
tests/model_registry/model_registry/rbac/conftest.py (2)
tests/conftest.py (1)
  • admin_client (79-80)
utilities/resources/model_registry_modelregistry_opendatahub_io.py (1)
  • ModelRegistry (9-94)
tests/model_registry/model_registry/rest_api/conftest.py (3)
tests/conftest.py (1)
  • admin_client (79-80)
tests/model_registry/conftest.py (1)
  • model_registry_namespace (57-58)
utilities/resources/model_registry_modelregistry_opendatahub_io.py (1)
  • ModelRegistry (9-94)
tests/model_registry/model_registry/rest_api/test_multiple_mr.py (3)
tests/conftest.py (1)
  • admin_client (79-80)
tests/model_registry/conftest.py (2)
  • model_registry_instance (284-320)
  • model_registry_namespace (57-58)
utilities/resources/model_registry_modelregistry_opendatahub_io.py (1)
  • ModelRegistry (9-94)
tests/model_registry/model_registry/negative_tests/test_model_registry_creation_negative.py (1)
tests/conftest.py (1)
  • admin_client (79-80)
tests/model_registry/model_registry/rest_api/test_model_registry_rest_api.py (3)
tests/conftest.py (1)
  • admin_client (79-80)
tests/model_registry/conftest.py (1)
  • model_registry_instance (284-320)
utilities/resources/model_registry_modelregistry_opendatahub_io.py (1)
  • ModelRegistry (9-94)
🪛 Flake8 (7.3.0)
tests/model_registry/model_registry/negative_tests/test_model_registry_creation_negative.py

[error] 6-6: 'tests.conftest.admin_client' imported but unused

(F401)


[error] 35-35: redefinition of unused 'admin_client' from line 6

(F811)

tests/model_registry/model_registry/rest_api/test_model_registry_rest_api.py

[error] 5-5: 'tests.conftest.admin_client' imported but unused

(F401)


[error] 172-172: redefinition of unused 'admin_client' from line 5

(F811)


[error] 173-173: continuation line unaligned for hanging indent

(E131)

🪛 Ruff (0.14.10)
tests/model_registry/model_registry/rest_api/test_multiple_mr.py

45-45: Unused method argument: model_registry_instance

(ARG002)

tests/model_registry/model_registry/negative_tests/test_model_registry_creation_negative.py

35-35: Redefinition of unused admin_client from line 6

(F811)

tests/model_registry/model_registry/rest_api/test_model_registry_rest_api.py

172-172: Redefinition of unused admin_client from line 5

(F811)

🔇 Additional comments (14)
tests/model_registry/model_catalog/conftest.py (1)

47-47: Correct type annotation for generator-based fixture.

The return type now accurately reflects that this fixture uses yield (line 90), aligning with similar fixtures in the file such as updated_catalog_config_map and update_configmap_data_add_model. This improves type safety and consistency.

tests/model_registry/model_registry/rest_api/conftest.py (3)

90-120: LGTM! Consistent admin_client usage in patch_invalid_ca.

The fixture correctly accepts admin_client and threads it through to the ConfigMap constructor.


142-174: LGTM! Proper admin_client integration for secure MySQL deployment.

The deploy_secure_mysql_and_mr fixture correctly passes client=admin_client to ModelRegistry construction, aligning with the PR's objective.


363-373: LGTM! Deployment constructor receives admin_client correctly.

The fixture signature and Deployment instantiation follow the established pattern.

tests/model_registry/model_registry/rbac/conftest.py (5)

141-154: LGTM! Parametrized secret fixture updated correctly.

The admin_client parameter is properly threaded to Secret construction.


157-172: LGTM! Parametrized PVC fixture updated correctly.

The admin_client parameter is properly threaded to PersistentVolumeClaim construction.


175-188: LGTM! Parametrized service fixture updated correctly.

The admin_client parameter is properly threaded to Service construction.


191-210: LGTM! Parametrized deployment fixture updated correctly.

The admin_client parameter is properly threaded to Deployment construction.


213-230: LGTM! ModelRegistry instances receive admin_client correctly.

The fixture properly instantiates ModelRegistry with client=admin_client, maintaining consistency with the PR pattern.

tests/model_registry/model_registry/negative_tests/conftest.py (2)

113-141: LGTM! Deployment construction uses admin_client.

The fixture correctly passes client=admin_client to the Deployment constructor.


171-177: LGTM! delete_mr_deployment fixture updated correctly.

The fixture properly accepts admin_client and uses it when constructing the Deployment.

tests/model_registry/model_registry/rest_api/test_multiple_mr.py (1)

44-52: LGTM! Test method correctly uses admin_client.

The test properly accepts admin_client and passes it to ModelRegistry construction with client=admin_client.

Note: The static analysis warning about model_registry_instance being unused is a false positive—it's used indirectly through pytest's fixture mechanism (Line 40 in @pytest.mark.usefixtures).

tests/model_registry/model_registry/rest_api/test_model_registry_rest_api.py (2)

170-183: LGTM! Client parameter threading implemented correctly.

The addition of admin_client parameter and passing it to the ModelRegistry constructor aligns with the PR objective to use the client argument for resource calls. The type annotation for model_registry_instance also improves code clarity.


185-192: LGTM! Type annotation improves clarity.

The type annotation for model_registry_instance is consistent with the changes in other test methods and enhances code readability.

Comment thread tests/model_registry/model_registry/rest_api/test_model_registry_rest_api.py Outdated
Comment thread tests/model_registry/model_registry/rest_api/test_model_registry_rest_api.py Outdated
@github-actions github-actions Bot added size/m and removed size/s labels Jan 7, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/model_registry/model_registry/negative_tests/test_model_registry_creation_negative.py (1)

54-69: Fix incorrect parameter name - use client= instead of client_token=.

Line 55 passes admin_client (a DynamicClient) to the client_token parameter, but the correct parameter name is client. This is confirmed by the pattern used consistently in other files (e.g., test_multiple_mr.py Line 52 uses client=admin_client).

The current_client_token: str parameter on Line 35 appears to be the actual token and is now unused.

🐛 Proposed fix
        with ModelRegistry(
-            client_token=admin_client,
+            client=admin_client,
            name=MR_INSTANCE_NAME,
            namespace=model_registry_namespace_for_negative_tests.name,
🧹 Nitpick comments (1)
tests/model_registry/model_registry/rest_api/test_multiple_mr.py (1)

44-49: Consider moving unused parameter to @pytest.mark.usefixtures.

The model_registry_instance parameter (Line 47) is declared but never referenced in the test body. While the fixture is needed for its setup side effects, consider moving it to the @pytest.mark.usefixtures decorator on Line 37 to make the intent clearer and eliminate the static analysis warning.

♻️ Proposed refactor
 @pytest.mark.usefixtures(
     "updated_dsc_component_state_scope_session",
     "model_registry_metadata_db_resources",
     "model_registry_instance",
 )
 class TestModelRegistryMultipleInstances:
     @pytest.mark.smoke
     def test_validate_multiple_model_registry(
         self: Self,
         admin_client: DynamicClient,
-        model_registry_instance: list[ModelRegistry],
         model_registry_namespace: str,
     ):
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1879d85 and 40e8be0.

📒 Files selected for processing (6)
  • tests/model_registry/model_registry/negative_tests/conftest.py
  • tests/model_registry/model_registry/negative_tests/test_model_registry_creation_negative.py
  • tests/model_registry/model_registry/rbac/conftest.py
  • tests/model_registry/model_registry/rest_api/conftest.py
  • tests/model_registry/model_registry/rest_api/test_model_registry_rest_api.py
  • tests/model_registry/model_registry/rest_api/test_multiple_mr.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/model_registry/model_registry/rest_api/test_model_registry_rest_api.py
  • tests/model_registry/model_registry/rbac/conftest.py
  • tests/model_registry/model_registry/rest_api/conftest.py
🧰 Additional context used
🧬 Code graph analysis (3)
tests/model_registry/model_registry/negative_tests/test_model_registry_creation_negative.py (1)
tests/conftest.py (1)
  • admin_client (79-80)
tests/model_registry/model_registry/negative_tests/conftest.py (1)
tests/conftest.py (1)
  • admin_client (79-80)
tests/model_registry/model_registry/rest_api/test_multiple_mr.py (3)
tests/conftest.py (1)
  • admin_client (79-80)
tests/model_registry/conftest.py (2)
  • model_registry_instance (284-320)
  • model_registry_namespace (57-58)
utilities/resources/model_registry_modelregistry_opendatahub_io.py (1)
  • ModelRegistry (9-94)
🪛 Ruff (0.14.10)
tests/model_registry/model_registry/rest_api/test_multiple_mr.py

47-47: Unused method argument: model_registry_instance

(ARG002)

🔇 Additional comments (3)
tests/model_registry/model_registry/rest_api/test_multiple_mr.py (1)

51-56: LGTM!

The ModelRegistry instantiation correctly uses client=admin_client, following the established pattern across the codebase.

tests/model_registry/model_registry/negative_tests/conftest.py (2)

121-141: LGTM!

The admin_client parameter is correctly threaded through to the Deployment constructor using client=admin_client (Line 122). The fixture properly manages the deployment lifecycle.


172-176: LGTM!

The delete_mr_deployment fixture correctly accepts admin_client and passes it to the Deployment constructor using client=admin_client (Line 175).

@dbasunag dbasunag force-pushed the update_client_mr_2 branch from 40e8be0 to a9549d2 Compare January 7, 2026 14:02
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/model_registry/model_registry/rest_api/test_multiple_mr.py (1)

45-57: Consider using the model_registry_instance fixture parameter directly.

The model_registry_instance parameter is declared but not used in the test body. Instead, the test recreates ModelRegistry objects with ensure_exists=True (lines 51-56). While this verifies the instances exist, it's redundant since the fixture already provides the created instances.

Consider refactoring to use the fixture parameter directly:

♻️ Proposed refactor
 def test_validate_multiple_model_registry(
     self: Self,
     admin_client: DynamicClient,
     model_registry_instance: list[ModelRegistry],
     model_registry_namespace: str,
 ):
-    for num in range(0, NUM_RESOURCES["num_resources"]):
-        mr = ModelRegistry(
-            client=admin_client,
-            name=f"{MR_INSTANCE_BASE_NAME}{num}",
-            namespace=model_registry_namespace,
-            ensure_exists=True,
-        )
+    for mr in model_registry_instance:
         LOGGER.info(f"{mr.name} found")
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 40e8be0 and a9549d2.

📒 Files selected for processing (7)
  • tests/model_registry/model_catalog/conftest.py
  • tests/model_registry/model_registry/negative_tests/conftest.py
  • tests/model_registry/model_registry/negative_tests/test_model_registry_creation_negative.py
  • tests/model_registry/model_registry/rbac/conftest.py
  • tests/model_registry/model_registry/rest_api/conftest.py
  • tests/model_registry/model_registry/rest_api/test_model_registry_rest_api.py
  • tests/model_registry/model_registry/rest_api/test_multiple_mr.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/model_registry/model_registry/rest_api/test_model_registry_rest_api.py
  • tests/model_registry/model_registry/negative_tests/conftest.py
  • tests/model_registry/model_catalog/conftest.py
🧰 Additional context used
🧬 Code graph analysis (2)
tests/model_registry/model_registry/negative_tests/test_model_registry_creation_negative.py (1)
tests/conftest.py (1)
  • admin_client (79-80)
tests/model_registry/model_registry/rest_api/test_multiple_mr.py (3)
tests/conftest.py (1)
  • admin_client (79-80)
tests/model_registry/conftest.py (2)
  • model_registry_instance (284-320)
  • model_registry_namespace (57-58)
utilities/resources/model_registry_modelregistry_opendatahub_io.py (1)
  • ModelRegistry (9-94)
🪛 Ruff (0.14.10)
tests/model_registry/model_registry/rest_api/test_multiple_mr.py

47-47: Unused method argument: model_registry_instance

(ARG002)

🔇 Additional comments (5)
tests/model_registry/model_registry/rbac/conftest.py (1)

142-238: LGTM! Consistent threading of admin_client through parametrized fixtures.

All five parametrized fixtures (db_secret_parametrized, db_pvc_parametrized, db_service_parametrized, db_deployment_parametrized, and model_registry_instance_parametrized) now correctly accept admin_client: DynamicClient and pass client=admin_client to their respective resource constructors. This ensures consistent client usage across the RBAC test suite.

tests/model_registry/model_registry/rest_api/test_multiple_mr.py (1)

51-56: Approve admin_client threading.

The addition of admin_client parameter and its use in ModelRegistry construction aligns with the PR objective to use client arg for resource calls.

tests/model_registry/model_registry/negative_tests/test_model_registry_creation_negative.py (1)

17-17: LGTM! Consistent admin_client usage in negative test.

The changes correctly:

  • Import DynamicClient (line 17)
  • Add admin_client parameter to the test method (line 34)
  • Pass client=admin_client to ModelRegistry constructor (line 55)

This aligns with the PR objective to thread admin_client through model registry resource calls.

Also applies to: 34-34, 54-70

tests/model_registry/model_registry/rest_api/conftest.py (2)

364-376: LGTM! Fixture correctly updated with admin_client.

The model_registry_default_postgres_deployment_match_label fixture now accepts admin_client: DynamicClient and correctly passes client=admin_client to the Deployment constructor (line 371). This ensures the Deployment object uses the provided admin client for cluster interactions.

Note: The AI summary incorrectly states that a ConfigMap fixture's return type changed to a generator. This fixture returns a dict[str, str] directly (line 376) and is not a generator.


105-109: Approve admin_client threading in ConfigMap and ModelRegistry fixtures.

The fixtures correctly pass client=admin_client to:

  • ConfigMap constructor in patch_invalid_ca (line 105)
  • ModelRegistry constructor in deploy_secure_mysql_and_mr (line 158)
  • ConfigMap constructor in ca_configmap_for_test (line 223)

This ensures consistent admin client usage across REST API test fixtures.

Also applies to: 158-158, 223-227

Copy link
Copy Markdown
Contributor

@sheltoncyril sheltoncyril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Copy link
Copy Markdown
Contributor

@fege fege left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@dbasunag dbasunag merged commit 7aab49a into opendatahub-io:main Jan 8, 2026
8 checks passed
@dbasunag dbasunag deleted the update_client_mr_2 branch January 8, 2026 12:20
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 8, 2026

Status of building tag latest: success.
Status of pushing tag latest to image registry: success.

mwaykole pushed a commit to mwaykole/opendatahub-tests that referenced this pull request Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants